package com.ruima.erp.framework.db.impl;

import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

import javax.sql.rowset.CachedRowSet;

import com.ruima.erp.framework.dao.DaoUtil;
import com.ruima.erp.framework.dao.IRmSysRoleUser;
import com.ruima.erp.framework.entity.RmSysRoleUser;


public class RmSysRoleUserImp implements IRmSysRoleUser {

	public List<RmSysRoleUser> getRmSysRoleUser() throws SQLException {
		List<RmSysRoleUser> list = new ArrayList<RmSysRoleUser>();
		String execSql = "select * from rm_sys_role_user";
		CachedRowSet crs = DaoUtil.SimpleQuery(execSql); 
		while(crs.next()){
			RmSysRoleUser rmsysroleuser  = new RmSysRoleUser();
			rmsysroleuser.setObjid(crs.getString("objid"));
			rmsysroleuser.setDisindex(crs.getString("disindex"));
			rmsysroleuser.setName(crs.getString("name"));
			rmsysroleuser.setCode(crs.getString("code"));			
			rmsysroleuser.setDescript(crs.getString("descript"));
			rmsysroleuser.setCreatetime(new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(crs.getDate("createtime"))); 
			rmsysroleuser.setUpdatetime(new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(crs.getDate("updatetime")));
			rmsysroleuser.setRoleobjid(crs.getString("roleobjid"));
			rmsysroleuser.setUserobjid(crs.getString("userobjid"));
			rmsysroleuser.setCreateuserObjid("createuserObjid");
			
			list.add(rmsysroleuser);
			System.out.println(list.toString());
		}
		return list;
	}
	public static void main(String args[]) throws SQLException{
		new RmSysRoleUserImp().getRmSysRoleUser();
	}
	
}
